﻿/*   */
$(function () {
    initAyjzbTableDatas();
    initAjhst();
    function initAyjzbTableDatas() {
        $("#ayjzb_tbody").empty(); // 清空原有数据
        CoreUtil.sendPost("/statistics/jajzayjzb", {"swjgDm": ""}, function (res) {
            let tableDatas = res.data.tableDatas;
            $.each(tableDatas, function (index, item) {
                let rowHtml  = "<tr>"
                        + "<td>" + item.MONTH + "</td>"
                        + "<td>" + item.JCS + "</td>"
                        + "<td>" + item.SLS + "</td>"
                        + "<td>" + item.ZXS + "</td>"
                        + "<td>" + item.CXS + "</td>"
                        + "<td>" + item.BJS + "</td>"
                        + "<td>" + item.ZJS + "</td>"
                        + "<td>" + item.QLV + "</td>"
                        + "</tr>";
                $("#ayjzb_tbody").append(rowHtml);
            });
        });
    }
    function initAjhst(){
        //案件耗时图
        //一类积案堆叠条形图
        let myChartajhst = echarts.init(document.getElementById('ajhst'));
        CoreUtil.sendPost("/statistics/jianjinzhan_ddtxt", null, function (res) {
            let yAxis_category_data = res.data.yAxis_category_data;
            let series_jiancha_data = res.data.series_jiancha_data;
            let series_shenli_data = res.data.series_shenli_data;
            let series_zhixing_data = res.data.series_zhixing_data;
            let option = {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    }
                },
                legend: {},
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {
                    type: 'value'
                },
                yAxis: {
                    type: 'category',
                    data: yAxis_category_data
                },
                series: [
                    {
                        name: '检查',
                        type: 'bar',
                        stack: 'total',
                        label: {
                            show: true
                        },
                        emphasis: {
                            focus: 'series'
                        },
                        data: series_jiancha_data

                    },
                    {
                        name: '审理',
                        type: 'bar',
                        stack: 'total',
                        label: {
                            show: true
                        },
                        emphasis: {
                            focus: 'series'
                        },
                        data: series_shenli_data

                    },
                    {
                        name: '执行',
                        type: 'bar',
                        stack: 'total',
                        label: {
                            show: true
                        },
                        emphasis: {
                            focus: 'series'
                        },
                        data: series_zhixing_data

                    }
                ]
            };

            if (option && typeof option === 'object') {
                myChartajhst.setOption(option);
            }
            window.addEventListener('resize', myChartajhst.resize);
        });
    }
});